import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [{
  path: '/information',
  name: 'information',
  component: () =>
    import('@/views/information')
}, {
  path: '/search',
  name: 'search',
  component: () =>
    import('@/views/search')
}, {
  path: '/channel',
  name: 'channel',
  component: () =>
    import('@/views/channel')
}, {
  path: '/details/:article_id',
  name: 'details',
  component: () =>
    import('@/views/details'),
  props: true // 开启props传参
}, {
  path: '/login',
  name: 'login',
  component: () =>
    import('@/views/login')
}, {
  path: '/',
  component: () =>
    import('@/views/layout'),
  children: [{
    path: 'home',
    name: 'home',
    component: () =>
      import('@/views/home')
  }, {
    path: 'qa',
    name: 'qa',
    component: () =>
      import('@/views/qa')

  }, {
    path: 'video',
    name: 'video',
    component: () =>
      import('@/views/video')
  }, {
    path: '',
    name: 'my',
    component: () =>
      import('@/views/my')
  }]
}]

const router = new VueRouter({
  routes
})

export default router
